﻿<html>
<head>
<title>Main</title>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
</head>
<body bgcolor="#FFFFFF" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" >
<div style="text-align:center; width:100%">
    <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
        <tr>
            <td style="width: 100%; height: 100px; background-image: url(images/); background-repeat:no-repeat; background-color:#61a0bc;" colspan="3">
            <select id="lbFeeds" onchange="get_rss_feed(  );">
               <option value="">SELECT A FEED</option>
                 
                <option value="http://www.dantri.com.vn/Home.rss">  
                    Trang chủ 
                </option> 
                <option value="http://www.dantri.com.vn/Sukien.rss">  
                    Sự kiện trong ngày
                </option> 
                <option value="http://www.dantri.com.vn/Thegioi.rss">  
                    Thế giới
                </option> 
                <option value="http://www.dantri.com.vn/The-Thao.rss"> 
                    Thể thao
                </option> 
                <option value="http://www.dantri.com.vn/giaoduc-khuyenhoc.rss"> 
                    Giáo dục - Khuyến học
                </option> 
                <option value="http://www.dantri.com.vn/giaitri.rss"> 
                    Giải trí
                </option> 
                <option value="http://www.dantri.com.vn/nhipsongtre.rss">  
                    Nhịp sống trẻ
                </option> 
                <option value="http://www.dantri.com.vn/tinhyeu-gioitinh.rss">  
                    Tình yêu - Giới tính
                </option> 
                <option value="http://www.dantri.com.vn/suckhoe.rss"> 
                    Sức khỏe
                </option> 
                <option value="http://www.dantri.com.vn/cong-nghe.rss">  
                    Sức mạnh số
                </option> 
                <option value="http://www.dantri.com.vn/kinhdoanh.rss">  
                    Kinh doanh
                </option> 
                <option value="http://www.dantri.com.vn/otoxemay.rss"> 
                    Ô tô - Xe máy
                </option> 
                <option value="http://www.dantri.com.vn/chuyenla.rss"> 
                    Chuyện lạ
                </option> 
                <option value="http://www.dantri.com.vn/vieclam.rss">  
                    Việc làm
                </option> 
                <option value="http://www.dantri.com.vn/tamlongnhanai.rss">  
                    Tấm lòng nhân ái
                 </option> 
                           
                <option value="http://www.dantri.com.vn/diendandantri.rss">  
                    Diễn đàn Dân trí 
                </option>				
           </select>
        </p>
            &nbsp;
            <input id="cbDetails" type="checkbox" onclick='format_rss_data ("DivMainContent", last_xml_response);' />
            show details   
    
            </td>
        </tr>
        <tr>
            <td style="width: 8px; height: 9px; background-image: url(images/G24_04.gif); background-repeat:no-repeat; background-color:#61a0bc;">
            </td>
            <td style="width: 100%; height: 9px; background-image: url(images/G24_06.gif); background-repeat:repeat-x; background-color:#61a0bc;">
            </td>
            <td style="width: 8px; height: 9px; background-image: url(images/G24_07.gif); background-repeat:no-repeat; background-color:#61a0bc;">
            </td>
        </tr>
        <tr>
            <td style="width: 8px; height: 209px; background-image: url(images/G24_08.gif); background-repeat:repeat-y; background-color:#61a0bc;">
            <div style="width:8px"></div>
            </td>
            <td style="width: 100%; vertical-align:top;">
            
            <!--*********************************** Menu content ****************************************************************-->
            <div id="DivMenuContent" style="height:31px; width:100%; background-image: url(images/G24_09.gif); background-repeat:repeat-x;">
            
            </div>
            
            <!--*********************************** Main content ****************************************************************-->
            <div id="DivMainContent" style="height:100%; width:100%;">
                        
            </div>
            
            </td>
            <td style="width: 8px; background-image: url(images/G24_08.gif); background-repeat:repeat-y; background-color:#61a0bc;">
            <div style="width:8px"></div>
            </td>
        </tr>
        <tr>
            <td style="width: 8px; height: 8px; background-image: url(images/G24_31.gif); background-repeat:no-repeat; background-color:#61a0bc;">
            </td>
            <td style="width: 100%; height: 8px; background-image: url(images/G24_32.gif); background-repeat:repeat-x; background-color:#61a0bc;">
            </td>
            <td style="width: 8px; height: 8px; background-image: url(images/G24_34.gif); background-repeat:no-repeat; background-color:#61a0bc;">
            </td>
        </tr>
    </table>    
</div>
</body>
</html>

<script language="javascript" type="text/javascript">
function FactoryXMLHttpRequest() {
    if(window.XMLHttpRequest) {
        return new XMLHttpRequest();
    }
    else if(window.ActiveXObject) {
        var msxmls = new Array(
        'Msxml2.XMLHTTP.5.0',
        'Msxml2.XMLHTTP.4.0',
        'Msxml2.XMLHTTP.3.0',
        'Msxml2.XMLHTTP',
        'Microsoft.XMLHTTP');
        for (var i = 0; i < msxmls.length; i++) {
            try {
                return new ActiveXObject(msxmls[i]);
            } 
            catch (e) 
            {
            }
        }
    }
    throw new Error("Could not instantiate XMLHttpRequest");
}
function get_xml_file (url) {
    var httpreq = new XMLHttpRequest(); //FactoryXMLHttpRequest();

    //Precondition: must have a URL
    if (url == "") return;

    httpreq.open("GET", url, true);

    httpreq.onreadystatechange = function (  ) {
        if (httpreq.readyState == 4) {
            var content = document.getElementById("DivMainContent");
            content.innerHTML = "Parsing XML...<br>";

            last_xml_response = httpreq.responseXML;
            format_rss_data ("DivMainContent", last_xml_response);
        }
    }
    var content = document.getElementById("DivMainContent");
    content.innerHTML = "<img src='loading.gif'>"		//"Retrieving XML...<br>";
    httpreq.send (null);
}
function get_rss_feed (  ) {

    //Get selected RSS feed
    var lbFeeds = document.getElementById("lbFeeds");
    if (lbFeeds.value != "") {
        get_xml_file (lbFeeds.value);
    }     
}
function format_rss_data (divname, response) {
    var html = "";
    var doc = response.documentElement;
    var items = doc.getElementsByTagName('item');

    for (var i=0; i < items.length; i++) {

        var title = items[i].getElementsByTagName('title')[0];
        var link = items[i].getElementsByTagName('link')[0];

        html += "<b><a href='" 
             + link.firstChild.data 
             + "' target=_blank >" 
             + title.firstChild.data 
             + "</a></b><br>";

        var cbDetails = document.getElementById("cbDetails");
        if (cbDetails.checked) {
            var desc = items[i].getElementsByTagName('description')[0];
            html += "<font size='-1'>" 
                    + desc.firstChild.data 
                    + "</font><p>";
        } 
    }
    var target_div = document.getElementById(divname);
    target_div.innerHTML = html;
}
</script>